﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;

namespace ABC.General
{
    public static class Categories
    {
        public static List<string> getListOfCategories()
        {
            List<string> _list = new List<string>();
            string sqlstring = "SELECT DISTINCT [CAT] FROM tabCAT";
            // using (OleDbConnection connection = new OleDbConnection(ConfigurationManager.ConnectionStrings["db"].ConnectionString))
            {
                try
                {
                    //connection.Open();
                    OleDbCommand command = new OleDbCommand(sqlstring, ABC.Database.DataBaseConnection.MyConn);
                    // OleDbCommand command = new OleDbCommand(sqlstring, connection);
                    OleDbDataReader aReader = command.ExecuteReader();
                    _list.Add("*");
                    while (aReader.Read())
                    {

                        _list.Add(aReader[0].ToString());
                    }
                }
                catch (Exception )
                {
                    throw;
                }
            }
            return _list;  

        }
    }
}
